﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;

namespace CANO.Data.DAOs.Usuario
{
	public static class UserHelper
	{
		public static bool IsManager(int UserRol)
		{
			if (UserRol == 1)
				return true;
			return false;
		}

		public static bool IsAsistente(int UserRol)
		{
			if (UserRol == 2)
				return true;
			return false;
		}

		public static bool IsBroker(int UserRol)
		{
			if (UserRol == 3)
				return true;
			return false;
		}

		public static bool ValidateUser(string Usuario, string Password)
		{
			using (dcCanoDataContext context = new dcCanoDataContext())
			{
				var user =
					(from u in context.Usuarios
					 where u.UserName == Usuario && u.Password == Password
					 select u);

				if (user.Count() != 0)
				{
					return true;
				}

				return false;
			}
		}
	}
}
